﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ALMKickstarter.Infrastructure;

namespace ALMKickstarter.Controllers
{
    public class FeatureController : Controller
    {
		private FeatureRepository repository;

		public FeatureController()
		{
			this.repository = new FeatureRepository();
		}

        //
        // GET: /Feature/
        public ActionResult Index()
        {
            return View();
        }

		//
		// GET: /Feature/ListByProject/ID
		public ActionResult ListByProject(int id)
		{
			return PartialView(repository.GetFeaturesByProject(id));
		}

        //
        // GET: /Feature/Details/5
        public ActionResult Details(int id)
        {
            return View();
        }

        //
        // GET: /Feature/Create
        public ActionResult Create(int project)
        {
			ViewBag.Project = project;
            return View();
        }

        //
        // POST: /Feature/Create
        [HttpPost]
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                // TODO: Add insert logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
        
        //
        // GET: /Feature/Edit/5
        public ActionResult Edit(int id)
        {
            return View();
        }

        //
        // POST: /Feature/Edit/5
        [HttpPost]
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add update logic here
 
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

        //
        // GET: /Feature/Delete/5
        public ActionResult Delete(int id)
        {
            return View();
        }

        //
        // POST: /Feature/Delete/5
        [HttpPost]
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here
 
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
    }
}
